import React, { useState } from "react";
import { update } from "../../services/student";
import InputElement from "../InputElement";
import RadioElement from "../RadioElement";
export default function (props) {
    console.log(props);
    const handleClick = async () => {
        console.log(props.student);
        await update(props.student);
        props.show();
    }
    return (
        <div>
            <h2>修改</h2>
            <InputElement value={props.student.name}
             onInput={e => props.setStudent({...props.student,name:e.target.value})}>姓名：</InputElement>
            <InputElement value={props.student.age}
             onInput={e => props.setStudent({...props.student,age:e.target.value})}>年龄：</InputElement>
            <RadioElement value={props.student.gender}
             onChange={e => props.setStudent({...props.student,gender:e.target.value})} name="updateGender">性别：</RadioElement>
            <input type="button" value="修改" onClick={handleClick} />
        </div>
    );
}
